package h.c.z.designPattern.C02_SingletonPattern;

/**
 * 单例模式-懒汉式(线程安全，同步代码块)（三）[不可用]
 * @author jinsicao
 */
public class Singleton_02_03 {

	private static Singleton_02_03 instance = null;
	
	private static int i = 0;
	
	private static int j = 0;
	
	private Singleton_02_03() {
		System.out.println("Singleton_02_03#" + i++);
	}
	
	public static Singleton_02_03 getInstance() {
		if (instance == null) {
			System.out.println("Singleton_02_03->getInstance#" + j++);
			synchronized (Singleton_02_03.class) {
				instance = new Singleton_02_03();
			}
		}
		return instance;
	}
}
